<div class="SipeiInfo pt20"><!--系统设置_4新增-->
          <?php //new CActiveForm();
			$form = $this->beginWidget('CActiveForm', array(
			'action' => $this->createUrl('/membership/default/membershipedit'),
			'method' => 'POST',
			'id' => 'myForm',
			'htmlOptions'=>array('target'=>'ajax-frame')
			));
    ?>
        <?php
        $membership_id = '';
        $membership_code = '';
        $membership_name = '';
        $edu_type = '';
        $disabled = 1;
        $description = '';
        if ($membershipinfo) {
            $membership_id = $membershipinfo['membership_id'];
            $membership_code = $membershipinfo['membership_code'];
            $membership_name = $membershipinfo['membership_name'];
            $edu_type = $membershipinfo['edu_type'];
            $disabled = $membershipinfo['disabled'];
            $description = $membershipinfo['description'];
        }
        ?>
        <table class="fontc_666 height32">
            <tbody>
            <input type="hidden" value="<?php echo $membership_id; ?>" name ="membership_id">
            <tr height="55">
                <td valign="top"  align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>代码：</td>
                <td valign="top"  class="formValidator_td">
                    <input type="text" value="<?php echo $membership_code; ?>" name='membership_code' id="membership_code" class="col3 pt5 pr10 pb5 pl10 height20 border_c border_3 fontc_666" />
                    <div class="formValidator_tip">
                        <p id="membership_codeTip" ></p>
                    </div>
                </td>
            </tr>
            <tr height="55">
                <td valign="top" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>名称：</td>
                <td valign="top" class="formValidator_td">
                    <input type="text" value="<?php echo $membership_name; ?>" name='membership_name' id="membership_name" class="col3 pt5 pr10 pb5 pl10 height20 border_c border_3 fontc_666" />
                    <div class="formValidator_tip">
                        <p id="membership_nameTip" ></p>
                    </div>
                </td>
            </tr>
            <tr height="55">
                <td valign="top" width="125" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>所属学段：</td>
                <td valign="top" class="formValidator_td">
                    <span class="fl standard_select pt5 pr7 pb5 pl3 border_c border_3">
                        <span class="fl select_shelter select_shelter2">
                            <select class="fl fontc_666" name='edu_type' id="edu_type">
                                <option value=''>请选择学段</option>
                                <?php if ($edutype): foreach ($edutype as $one): ?>
                                        <option value='<?php echo $one['edu_id'] ?>' <?php
                                        if ($one['edu_id'] == $edu_type): echo "selected";
                                        endif;
                                        ?>><?php echo $one['edu_name'] ?></option>
                                                <?php
                                            endforeach;
                                        endif;
                                        ?>
                            </select>
                        </span>
                    </span>
                    <div class="formValidator_tip">
                        <p id="edu_typeTip" ></p>
                    </div>
                </td> 
            </tr>           
            <tr>
                <td align="right" class="pr5">是否生效：</td>
                <td><input type="checkbox" value='1' <?php
                    if ($disabled == 1): echo "checked";
                    endif;
                    ?>  name='disabled'/></td>
            </tr>
            <tr>
                <td align="right" valign="top" class="pt10 pr5">备注：</td>
                <td class="pt10"><textarea class="col3 pt6 pr10 pb6 pl10 border_c border_3 fontc_666" name='description'><?php echo $description; ?></textarea></td>
            </tr>
            <tr>
                <td colspan="2" align="center" class="pt20 pb20">
                    <input type="submit" value="保存" class="b_a_n border_3 back_bgfb w80 height32 fontc_FFF fonts_12 mr10" />
                    <input type="button" value="取消" onclick="api.close()"  class="b_a_n border_3 back_bgb w80 height32 fontc_FFF fonts_12" />
                </td>
            </tr>
            </tbody>
        </table>
   <?php
    $this->endWidget();
    ?>
</div>
<iframe src='' style="display:none" name='ajax-frame'></iframe>
<script>
$(function(){
	$.formValidator.initConfig({formID:"myForm",theme:"126",submitOnce:false,
        onError:function(msg,obj,errorlist){
                $("#errorlist").empty();
                $.map(errorlist,function(msg){
                        $("#errorlist").append("<li>" + msg + "</li>")
                });
                alert(msg);
        }
	});

	/*代码验证*/
	$("#membership_code").formValidator({
		onShowText:"请输入代码",
		onShow:"",
		onFocus:"",
		onCorrect:"输入正确",
		leftTrim:true,
		rightTrim:true
	}).inputValidator({
		min:1,
		max:20,
		onError:"代码长度在1-20之间"
	});

	/*名称验证*/
	$("#membership_name").formValidator({
		onShowText:"请输入代码",
		onShow:"",
		onFocus:"",
		onCorrect:"输入正确",
		leftTrim:true,
		rightTrim:true
	}).inputValidator({
		min:1,
		max:20,
		onError:"名称长度在1-20之间(1到10个汉字)"
	});

	/*所属学段验证*/
	$("#edu_type").formValidator({
		onShowText:"",
		onShow:"",
		onFocus:"",
		onCorrect:"已选择"
	}).inputValidator({
		min:1,
		onError:"请选择所属学段"
	});
	
})
</script>
<?php exit; ?>